package com.dev201121.listeners;

import com.dev201121.config.AppConfig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.web.context.ContextLoaderListener;

import javax.servlet.ServletContext;

public class MyLinstener extends ContextLoaderListener {


    @Override
    protected ApplicationContext loadParentContext(ServletContext servletContext) {
        AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext();
        ac.register(AppConfig.class);
        ac.refresh();
        System.out.println("自定义的容器启动完毕，作为顶级父级容器来使用");

        return ac;

    }
}
